[quality] test: pin session-revocation persistence failure semantics (src/pkg/hub/hub_session_revocation.go saveRevokedSessions/loadRevokedSessions) - #6355
Conversation
…aveRevokedSessions/loadRevokedSessions) The fail-closed and durability error paths of the hub session revocation store were untested: unreadable-file load (fail closed), corrupt-file quarantine rename failure, load-time prune rewrite, and the MkdirAll/ WriteFile/Rename failure branches of saveRevokedSessions. These are the security-critical directions — silently forgetting revocations un-revokes sessions. loadRevokedSessions 68.4% -> 100%, saveRevokedSessions 57.9% -> 89.5%, revokeHubSessionCookieAt 77.3% -> 90.9%. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: hive-quality <sec-check@hive.kubestellar.io>
|
Changelog: this PR changes code but carries no changelog entry If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Summary
Adds
src/pkg/hub/hub_session_revocation_persistence_test.gopinning the untested failure-path semantics of the hub session-revocation store (src/pkg/hub/hub_session_revocation.go):loadRevokedSessionswith an existing-but-unreadable file → fails CLOSED (every sid reads revoked; surfaced viahubSessionRevokedLookup), and a later successfulloadclears the mode.saveRevokedSessionsMkdirAll / WriteFile / Rename failures → logged, non-fatal (it runs on the logout request path), and a failed save leaves the last good file byte-identical and the in-memory revocation intact.revokedSessionsand theHubServerwrappers; input-shape guards and duplicate-revoke semantics ofrevokeHubSessionCookieAt(with a positive control minting a real v3 cookie).Coverage:
loadRevokedSessions68.4% → 100%,saveRevokedSessions57.9% → 89.5%,revokeHubSessionCookieAt77.3% → 90.9%. Full./pkg/hubsuite green (142s),go vetclean. Permission-based failure injection is skipped under root (same guard ashub_generations_store_test.go).Claimed ground
Only
src/pkg/hub/hub_session_revocation.gopersistence/guard functions and the new test file. Disjoint from open quality PRs #6349 (github/prclaims), #6348 (dashboard reissue token), #6343 (dashboard terminal handoff), #6342 (github IssueClosedAt), #6330 (agent thrash poller), #6292 (local mode write roots).Test plan
go test ./pkg/hub/— all passgo vet ./pkg/hub/— cleanFiled by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5